<?php

class Error_ShowController extends Zend_Controller_Action
{
    /**
     * The controller's init() function is called before 
     * the action. Usually we use it to set up the ACL
     * restrictions for the actions within the controller.
     *
     */
    public function init()
    {       
        $this->_helper->acl->allow(null);
    }
    
    public function indexAction()
    {
     	$errors = $this->_getParam('error_handler'); 
        switch ($errors->type) {
            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
            case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
                // 404 error -- controller or action not found
                $this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found');
                $this->view->errorType = 404;
                $this->view->exception = $errors->exception;
            	//echo $this->view->escape('page d\'erreur personnalisée dans le module default controlleur Erro');
                break;
            default:
                throw $errors->exception;
                break;
        }
    	
        $logFile = Zend_Registry::get('config')->logFiles->error;
        $log = new Zend_Log(new Zend_Log_Writer_Stream($logFile));
        $log->debug($errors->exception->getMessage() . "\n" .  $errors->exception->getTraceAsString()); 
        //exit;
    	$this->view->WmpLog('page introuvable');
    }
    
    public function deniedAction()
    {
    }    
}